package com.example.design.patterns.geekbang.创建型.单例模式.替代方案.单机;

import java.util.concurrent.atomic.AtomicLong;

// 静态方法实现方式
public class IdGenerator {
    private static AtomicLong id = new AtomicLong(0);

    public static long getId() {
        return id.incrementAndGet();
    }
}
// 使用举例
//long id = IdGenerator.getId();
